<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/23 0023
 * Time: 23:24
 */
//预备语句
$conn = mysqli_connect('localhost', 'root', 'root', 'test');


if (mysqli_connect_errno()) {
    die(mysqli_connect_error());
}

// $conn->query("CREATE TABLE alfas" .
//    " (`year` INTEGER, `model` VARCHAR(50), `accel` REAL)")or die('fail');
$stmt = $conn->prepare("SELECT * FROM alfas ORDER BY `year`") or die('fail2');
$stmt->execute();
$stmt->bind_result($year, $model, $accel);
while ($stmt->fetch()) {
    echo $year . '--' . $model . '--' . $accel ."\r\n";
}

//$result->free();
$conn->close();